Repository Public
1import { notFound } from "next/navigation";2import type { Metadata } from "next";3import { publicProfile } from "@/lib/api/public";4import { PublicFrame } from "@/components/public/frame";5import { BookingFlow } from "@/components/public/booking-flow";67export const dynamic = "force-dynamic";89async function find(slug: string) {10 const data = await publicProfile();11 const type = data.types.find((t) => t.slug === slug);12 return data.configured && type ? { profile: data.profile, type } : null;13}1415export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> {16 const f = await find((await params).slug);17 return f ? { title: `${f.type.title} — ${f.profile.name}` } : { title: "Introuvable" };18}1920export default async function BookPage({ params }: { params: Promise<{ slug: string }> }) {21 const f = await find((await params).slug);22 if (!f) notFound();23 return (24 <PublicFrame brand={f.profile.brandColor}>25 <BookingFlow type={f.type} owner={{ name: f.profile.name, timezone: f.profile.timezone, hasAvatar: f.profile.hasAvatar, emailEnabled: f.profile.emailEnabled }} />26 </PublicFrame>27 );28}29